<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>重置密码-{eyou:global name='web_name' /}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<link href="{eyou:global name='web_cmspath' /}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    {eyou:static file="users/skin/css/basic.css" /}
    {eyou:static file="users/skin/css/eyoucms.css" /}
    {eyou:include file="users/skin/css/diy_css.htm" /}
    
    {eyou:static file="/public/static/common/js/jquery.min.js"/}
    {eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
    {eyou:static file="users/skin/js/global.js" /}
</head>

<body class="reg">


<div class="register_index ey-member">
    <div class="container">
        <form name='theForm' id="theForm" class="form-register panel-body fv-form">
            <div class="mip-reg-logo"><a href="{eyou:global name='web_cmsurl' /}" class="ey-logo"><img src="{eyou:global name='web_logo'/}" /></a></div>
            <div class="mip-reg-heading">重置密码</div>
            <div class="form-group group_z">
                <div class="input-group">
                    <span class="input-group-addon" style="color: red;"><i class="fa fa-user"></i>&nbsp;</span>
                    <input type="text" class="form-control" value="{$users.username|default=''}" disabled="true"/>
                </div>
            </div>

            <div class="form-group group_z">
                <div class="input-group">
                    <span class="input-group-addon" style="color: red;"><i class="fa fa-lock"></i>*</span>
                    <input type="password" name="password" id="password" class="form-control" placeholder="新密码" autocomplete="off"/>
                </div>
            </div>

            <div class="form-group group_z">
                <div class="input-group input-group-icon">
                    <span class="input-group-addon" style="color: red;"><i class="fa fa-lock"></i>*</span>
                    <input type="password" name="password_" id="password_" class="form-control" placeholder="确认新密码" autocomplete="off"/>
                </div>
            </div>

            <button class="btn btn-lg btn-primary btn-block group_z" style="width: 100%;" onclick="check_submit();" type="button">确认提交</button>
        </form>
    </div>
</div>

<script type="text/javascript">
    $(document).keydown(function(event){
        if(event.keyCode ==13){
            check_submit();
        }
    });

    function check_submit()
    {
        var password  = $('#theForm input[name=password]').val();
        var password_ = $('#theForm input[name=password_]').val();
        
        if(password == ''){
            layer.msg('新密码不能为空！', {time: 1000});
            $('#theForm input[name=password]').focus();
            return false;
        }
        
        if(password_ == ''){
            layer.msg('确认密码不能为空！', {time: 1000});
            $('#theForm input[name=password_]').focus();
            return false;
        }
            
        if(password != password_){
            layer.msg('两次密码不一致！', {time: 1000});
            $('#theForm input[name=password]').focus();
            return false;
        }

        layer_loading('正在处理');
        $.ajax({
            // async:false,
            url: "{eyou:url link='user/Users/reset_password' /}",
            data: $('#theForm').serialize(),
            type:'post',
            dataType:'json',
            success:function(res){
                layer.closeAll();
                if (res.code == 1) {
                    layer.msg(res.msg, {time: 1500}, function(){
                        window.location.href = res.url;
                    });
                } else {
                    layer.msg(res.msg, {time: 2000, icon: 5});
                }
            },
            error : function(e) {
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    };
</script>
</body>
</html>